import { InjectionKey } from 'vue'
import { createStore, useStore as baseUseStore, Store } from 'vuex'



export interface State {
    count: number,
    componentIdArray: Array<number>
  }

export const key: InjectionKey<Store<State>> = Symbol('')
// Create a new store instance.
export const store = createStore<State>({
  state: {
    count: 101,
    componentIdArray: [],
  },
  mutations: {
    setCompId(state) {
        state.componentIdArray = [1, 12, 33]
    }
  }
})

// 定义自己的 `useStore` 组合式函数
export function useStore () {
  return baseUseStore(key)
}
